<template>
	<view class="" style="padding-bottom: 150rpx;">
		<u-navbar title="使用管理" placeholder>
			<view class="flexleft" slot="left">
				<view @click="backpage">
					<u-icon name="arrow-left" color="#333333" size="20"></u-icon>
				</view>
				<view class="xiaohui margin_left1" style="font-size: 24rpx;" v-if="hy_type==3 || hy_type==7"
					@click="jumpurl('/pages/workbench/shengyufj')">剩餘房間</view>
			</view>
			<view class="flexright" slot="right">
				<view class="xiaohui margin_right" @click="jumpurl('/pages/workbench/xinzengzt')">添加</view>
				<view class="xiaohui" @click="jumpurl('/pages/workbench/xinzengztpl')">批量添加</view>
			</view>
		</u-navbar>
		<view class="mainpadding2">
			<view v-show="hy_type==0 || hy_type==1 || hy_type==6">
				<view class="margin_top">
					<scroll-view class="white_nowrap" scroll-x>
						<view class="flexleft">
							<view class="margin_right2" v-for="(item,index) in lclist">
								<view :class="lc_id==item.id?'cateSelect':'cateNoSelect'" @click="selectCate(item)">
									{{item.name}}
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
				<view v-show="!list.data.length">
					<view class="flexcenter">
						<view class="placeholderimage" style="margin-top: 100rpx;"></view>
					</view>
				</view>
				<view class="flexbetween flex_wrap" style="padding-bottom: 150rpx;">
					<view class="flexbetween" style="width: 48%;" v-for="item in list.data" :key="item.id">
						<!-- 空余 -->
						<view v-if="item.status==0" class="ffffff margin_top radius flexcolumn itembox itembox1"
							style="width: 100%;" @click="edititem(item)">
							<view class="flexcolumn listtop">
								<view class="lv_text titletext bold margin_top">空餘</view>
								<view class="hei_text bold main_size">可入座：{{item.count}}人</view>
								<view class="xiaobiao xiaobiao1">{{item.endtime}}</view>
							</view>
							<view class="bottomzh bottomzh1">{{item.num}}</view>
						</view>
						<!-- 使用中 -->
						<view class="ffffff margin_top radius flexcolumn itembox itembox2" style="width: 100%;"
							v-if="item.status==1 && Number(item.zhuimoney)" @click="edititem(item)">
							<!-- 服務图片 -->
							<view class="flexcolumn listtop">
								<view class="huang_text flexleft titletext bold margin_top">
									<u-count-down
										:time="(Number(item.createtime)*1000+item.endtime*60*1000)-Number(new Date())"
										format="HH:mm:ss"></u-count-down>
									<text class="margin_left1">結束</text>
								</view>
								<view class="hong_text bold main_size" v-show="item.zhuimoney">未付：{{item.zhuimoney}}
								</view>
								<view class="hei_text bold main_size">老人：{{item.lao_count}} 客戶：{{item.ke_count}}</view>
								<view class="hei_text bold main_size">兒童：{{item.er_count}}
									合計：{{Number(item.lao_count)+Number(item.ke_count)+Number(item.er_count)}}</view>
								<view class="xiaohong margin_top">
									{{http.timereturn(Number(item.createtime)*1000+item.endtime*60*1000)}}
								</view>
							</view>
							<view class="bottomzh bottomzh2">{{item.num}}</view>
						</view>
						<!-- 未付款為0 -->
						<view class="ffffff margin_top radius flexcolumn itembox itembox3" style="width: 100%;"
							v-if="item.status==1 && !Number(item.zhuimoney)" @click="edititem(item)">
							<!-- 服務图片 -->
							<view class="flexcolumn listtop">
								<view class="huang_text flexleft titletext bold margin_top">
									<u-count-down
										:time="(Number(item.createtime)*1000+item.endtime*60*1000)-Number(new Date())"
										format="HH:mm:ss"></u-count-down>
									<text class="margin_left1">結束</text>
								</view>
								<view class="hong_text bold main_size" v-show="item.zhuimoney">未付：{{item.zhuimoney}}
								</view>
								<view class="hei_text bold main_size">老人：{{item.lao_count}} 客戶：{{item.ke_count}}</view>
								<view class="hei_text bold main_size">兒童：{{item.er_count}}
									合計：{{Number(item.lao_count)+Number(item.ke_count)+Number(item.er_count)}}</view>
								<view class="xiaohong margin_top">
									{{http.timereturn(Number(item.createtime)*1000)}}
								</view>
							</view>
							<view class="bottomzh bottomzh2">{{item.num}}</view>
						</view>
						<!-- 已過期 -->
						<view class="ffffff margin_top radius flexcolumn itembox itembox3" style="width: 100%;"
							v-show="item.status==2" @click="edititem(item)">
							<view class="flexcolumn listtop">
								<view class="huang_text flexleft titletext bold margin_top">
									<u-count-down
										:time="(Number(item.createtime)*1000+item.endtime*60*1000)-Number(new Date())"
										format="HH:mm:ss"></u-count-down>
									<text class="margin_left1">結束</text>
								</view>
								<view class="hei_text bold main_size" style="color: #ff5c00;">已過期</view>
								<view class="hei_text bold main_size">可入座：{{item.count}}人</view>
								<view class="xiaobiao xiaobiao3">{{item.endtime}}</view>
							</view>
							<view class="bottomzh bottomzh3">{{item.num}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-if="hy_type==3 || hy_type==7">
			<u-sticky bgColor="#f9f9f9">
				<view class="mainpadding2">
					<view class="flexbetween mainpadding">
						<view class="titletext  xiaohei nofonweight" style="color: #ff5c00;"
							@click="changeMonth('pre')">上一月
						</view>
						<view class="titletext xiaohei fonweight">{{y+'年'+formatNum(m)+'月'}}</view>
						<view class="titletext  xiaohei nofonweight" style="color: #ff5c00;"
							@click="changeMonth('next')">下一月
						</view>
					</view>
					<view class="margin_top">
						<scroll-view class="white_nowrap" scroll-x>
							<view class="flexleft">
								<view class="margin_right2" v-for="(item,index) in lclist">
									<view :class="lc_id==item.id?'cateSelect':'cateNoSelect'" @click="selectCate(item)">
										{{item.name}}
									</view>
								</view>
							</view>
						</scroll-view>
					</view>
				</view>
			</u-sticky>
			<view class="mainpadding2">
				<view class="flexleft" style="align-items: flex-start;">
					<!-- <u-switch inactiveColor="rgb(230, 230, 230)" v-model="jdvalue" activeColor="#ffb800"></u-switch> -->
					<view class="flexcolumn" style="align-items: flex-start;">
						<view class="flexleft" style="align-items: flex-start;" :class="index==0?'margin_top6':''"
							v-for="(item,index) in leftzt" :key="index">
							<u-switch inactiveColor="rgb(230, 230, 230)" size="16" v-model="item.table_status"
								activeColor="#ffb800" @change="changejd(item.table_status,item.id)"></u-switch>
							<view v-show="houtel_type==1">
								<view class="main_size itemleftbox"
									:style="{color:item.house.length && item.house[0].status==3?'#ff0000':'#333'}"
									@click="editzhusu(item,1)">
									{{item.num}}
								</view>
							</view>
							<view v-show="houtel_type==2">
								<view class="xiaohei main_size itemleftbox" @click="editzhusu(item,0)">{{item.num}}
								</view>
							</view>
							<!-- 状态:1=未入住,2=已入住,3=待打扫,4=维修中 -->
							<view class="flexcolumn">
								<view class="main_size itemleftbox" v-if="current.type!=1&&houtel_type==2"
									@click="editzhusu(item,2,current)" v-for="current in item.house" :key="current.id"
									:style="{color:current.status==3?'#ff0000':'#333'}">
									{{current.name}}
								</view>
							</view>
						</view>
					</view>
					<!-- choose_status:0没有信息，1可以選擇，2已售，3不可選擇，4已選擇 -->
					<scroll-view class="margin_top" scroll-x="true" :style="{width: houtel_type==1?'78%':'65%'}">
						<view class="flexleft" style="margin-right: 2rpx;">
							<view class="flexcolumn" v-for="(item,index) in rightHouse" :key="index">
								<view class="xiaohei main_size" style="width: 120rpx;text-align: center;">{{item.name}}
								</view>
								<view class="itemboxzs flexcenter xiaobai smalltext" @click="dingdan(item,ite)"
									v-for="(ite,inde) in item.childhouse" :key="inde"
									:class="ite.houseInfo!=null?(ite.houseInfo.order_status==20?'bghuang':ite.houseInfo.order_status==30?'bglan':'bglv'):ite.ShoptableLock!=null?'bghong':''">
									<text v-if="ite.houseInfo!=null && ite.houseInfo.order_status==20">待</text>
									<text v-if="ite.houseInfo!=null && ite.houseInfo.order_status==30">住</text>
									<text v-if="ite.houseInfo!=null && ite.houseInfo.order_status==40">完</text>
									<text v-if="ite.ShoptableLock!=null">鎖</text>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</view>
		<u-popup :show="editshow" mode="center" @close="editshow = false" round="10">
			<view style="padding: 60rpx 100rpx;">
				<view class="flexcenter titletext bold hei_text">選擇操作類型</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="diancan"
					v-show="(status==0||status==1) && currentitem.ordergoods && currentitem.ordergoods.order_type!=3">
					加點商品</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="chidaobaodc(currentitem.order_make_id,currentitem.ordergoods.cdbtc_id)"
					v-show="(status==0||status==1) && currentitem.ordergoods && currentitem.ordergoods.order_type==3">
					加點商品</view>
				<view class="resetbtn3 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="chidaobao()" v-if="status==0 && hy_type==1">計時</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="jiezhang" v-show="status==1 && Number(currentitem.zhuimoney)">結帳</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="editDesk()" v-show="(status==0||status==2) && shopInfo.is_shop==2">編輯</view>
				<!-- <view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="editshow=false,show=true" v-show="status==0||status==2">刪除</view> -->
				<view class="surebtn2 flexcenter mainpadding margin_top main_size bold"
					@click="editshow=false,clearShow=true" v-show="status==1 && !Number(currentitem.zhuimoney)">清桌
				</view>
			</view>
		</u-popup>
		<!-- 刪除二次確認弹窗 -->
		<u-modal :show="show" showCancelButton confirmColor="#ffb800" @cancel="show=false" @confirm="confirm"
			confirmText="確認" cancelText="取消">
			<view class="color_ling text_weight text">
				您確定要刪除此使用嗎？
			</view>
		</u-modal>
		<!-- 清桌二次確認弹窗 -->
		<u-modal :show="clearShow" showCancelButton confirmColor="#ffb800" @cancel="clearShow=false" confirmText="確認"
			cancelText="取消" @confirm="clearConfirm">
			<view class="color_ling text_weight text">
				您確定要清桌嗎？
			</view>
		</u-modal>
		<view class="posibottom flexbetween mainpadding2">
			<view class="leftresetbtn flexcenter ffffff main_size xiaohuang bold" @click="xzzhshow=true">下載桌號
			</view>
			<view class="resetbtn flexcenter ffffff main_size xiaohuang  bold" @click="dyShoptable">列印二維碼
			</view>
			<view class="surebtn flexcenter main_size xiaohei bold" @click="zhengtitz">整體調整</view>
		</view>
		<u-popup :show="dsshow" mode="center" @close="dsshow = false" round="10">
			<view style="padding: 60rpx 100rpx;">
				<view class="flexcenter titletext bold hei_text">選擇操作類型</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="dasao">
					房間已打掃</view>
				<view class="resetbtn2 flexcenter ffffff mainpadding margin_top2 huang_text main_size bold"
					@click="editDesk()">編輯</view>
			</view>
		</u-popup>

		<u-popup :show="xzzhshow" mode="center" @close="xzzhshow = false" round="10">
			<view class="mainpadding" style="width: 600rpx;">
				<view class="titletext xiaohei textcenter bold">選擇樣式後下載</view>
				<view class="margin_top">
					<u-swiper :list="list3" previousMargin="30" :current="lbtcurrent" keyName="image_text" height="150"
						nextMargin="30" :autoplay="false" bgColor="#ffffff" @change="lbtchange"></u-swiper>
				</view>
				<view class="flexcenter margin_top">
					<view class="leftresetbtn flexcenter ffffff main_size xiaohuang bold" style="width: 80%;"
						@click="confirmxz()">就這個，立即下載
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list3: [],
				clearShow: false,
				show: false,
				editshow: false, //编辑使用
				shop_id: uni.getStorageSync("shop_id"),
				list: {
					data: []
				},
				id: "", //要操作的使用id
				status: "", //状态:0空闲,1有人,2过期
				order_goods_id: "", //内用订單id
				currentitem: {},
				shopInfo: {},
				hy_type: 1, //0买卖，1计时，3住宿
				y: new Date().getFullYear(), // 年
				m: new Date().getMonth() + 1, // 月
				leftzt: [],
				rightHouse: [],
				lastTapDiffTime: 0,
				lastTapTimeoutFunc: null,
				lclist: [],
				lc_id: 0,
				jdvalue: false,
				houtel_type: uni.getStorageSync("houtel_type"),
				type: 0, //1pos點餐點擊進入
				dsid: "",
				dsshow: false,
				xzzhshow: false,
				lbtcurrent: 0
			}
		},
		onLoad(options) {
			if (options.type) {
				this.type = options.type
			}
			this.hy_type = uni.getStorageSync("hy_type")
			this.getqy()
		},
		onShow() {
			if (this.hy_type == 3 || this.hy_type == 7) {
				this.getzhusuInfo()
			} else {
				this.getList()
			}
			this.getshopDetail()
			this.getzttpList()
		},
		methods: {
			confirmxz() { //選擇樣式下載
				uni.showLoading({
					mask: true,
					title: "數據請求中"
				})
				this.http.requestuser("/api/Poster/getShoptable", 'POST', {
					shop_id: this.shop_id,
					poster_id: this.list3[this.lbtcurrent].id
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						this.fenbaodown(res.data)
					} else {
						this.http.toast(res.msg)
					}
				})
			},
			async fenbaodown(arr) {
				for (let i = 0; i < arr.length; i++) {
					await new Promise(resolve => setTimeout(resolve, 150))
					this.downloadFile(arr[i])
				}
			},
			async downloadFile(url) {
				uni.downloadFile({
					url, //下载地址接口返回
					success: (data) => {
						if (data.statusCode === 200) {
							//隐藏加载框
							uni.hideLoading();
							//文件保存到本地
							// #ifdef H5
							const a = document.createElement('a');
							a.href = data.tempFilePath; //filePath 这里的地址是 uni.downloadFile 中的返回值里的地址
							a.download = ""; // 可以设置下载文件名，如果是空字符串，则使用服务器端设置的文件名
							a.click();
							// #endif
						}
					},
					fail: (err) => {
						uni.showToast({
							icon: 'none',
							mask: true,
							title: '文件下載失敗',
						});
					},
				});
			},
			lbtchange(e) {
				this.lbtcurrent = e.current
			},
			getzttpList() {
				this.http.requestuser("/api/Poster/index", 'POST', {
					shop_id: this.shop_id,
					data_type: 1
				}).then(res => {
					this.list3 = res.data
				})
			},
			zhengtitz() {
				if (this.lc_id == 0) {
					this.http.toast("請選擇區域後操作！")
					return false
				}
				this.jumpdetail('/pages/workbench/zhuotaizttz?id=', this.lc_id)
			},
			changejd(datas, id) {
				console.log(datas);
				this.http.request("/api/shop/edittableInfo", 'POST', {
					id,
					table_status: datas ? 1 : 2
				}).then(res => {
					this.http.toast(res.msg)
				})
			},
			chidaobao() {
				uni.navigateTo({
					url: "/pages/workbench/tianjiacdbkh?id=" + this.id
				})
			},
			selectCate(item) {
				this.lc_id = item.id
				this.getzhusuInfo()
				this.getList()
			},
			getqy() {
				this.http.request("/api/shop/shopAreaIndex", "GET", {
					shop_id: uni.getStorageSync("shop_id"),
				}).then(res => {
					this.lclist = res.data
					res.data.unshift({
						id: 0,
						name: "全部"
					})
				})
			},
			dingdan(item, ite) { // 單击或双击
				const _this = this;
				const currentTime = Date.now()
				const gap = currentTime - this.lastTapDiffTime
				if (this.lastTapTimeoutFunc) {
					clearTimeout(this.lastTapTimeoutFunc)
					this.lastTapTimeoutFunc = null
				}
				// 如果兩次點擊間隔小於250ms，則視為雙擊
				if (gap > 0 && gap < 250) {
					console.log('雙機');
					if (ite.houseInfo == null) {
						this.suofang(item, ite)
					}
					this.lastTapDiffTime = 0
				} else {
					this.lastTapDiffTime = currentTime
					// 單擊延時處理（可選）
					if (ite.houseInfo == null) {
						this.suofang(item, ite)
					}
					this.lastTapTimeoutFunc = setTimeout(() => {
						console.log('dan機');
						if (this.lastTapDiffTime !== 0 && Date.now() - this.lastTapDiffTime >= 250) {
							if (ite.houseInfo) {
								uni.navigateTo({
									url: "/pages/yuYueOrder/zhusuxq?id=" + ite.houseInfo.id
								})
							}
							this.lastTapDiffTime = 0
						}
					}, 250)
				}
			},
			suofang(item, ite) {
				let date = this.y + "-" + (Number(this.m) > 9 ? this.m : '0' + this.m) + '-' + item.name
				this.http.request("/api/shop/shoptableLock", 'POST', {
					shop_id: uni.getStorageSync("shop_id"),
					start_date: date,
					end_date: this.http.returnDate(Number(new Date(date)) + 24 * 60 * 60 * 1000),
					id: ite.deskId,
					house_id: ite.houseId,
					sd_type: ite.ShoptableLock == null ? 1 : 2 //sd_type  1=锁定  2=解锁
				}).then(res => {
					this.http.toast(res.msg)
					if (res.code == 1) {
						this.getzhusuInfo()
					}
				})
			},
			changeMonth(type) {
				if (type == 'pre') {
					if (this.m + 1 == 2) {
						this.m = 12;
						this.y = this.y - 1;
					} else {
						this.m = this.m - 1;
					}
				} else {
					if (this.m + 1 == 13) {
						this.m = 1;
						this.y = this.y + 1;
					} else {
						this.m = this.m + 1;
					}
				}
				this.getzhusuInfo()
			},
			formatNum(num) {
				let res = Number(num);
				return res < 10 ? '0' + res : res;
			},
			getshopDetail() {
				this.http.request("/api/shop/Shopdeail", 'POST', {
					shop_id: uni.getStorageSync("shop_id")
				}).then(res => {
					this.shopInfo = res.data
				})
			},
			dyShoptable() {
				let _this = this
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				this.http.request('/api/shop/dyShoptable', 'GET', {
					shop_id: uni.getStorageSync("shop_id")
				}).then(res => {
					uni.hideLoading()
					this.http.toast(res.msg)
				})

			},
			async getList() { //使用列表
				let _this = this
				uni.showLoading({
					mask: true,
					title: "加載中"
				})
				let res = await this.http.request('/api/shop/listtable', 'POST', {
					shop_id: this.shop_id, //店鋪id
					lc_id: this.lc_id
				})
				uni.hideLoading()
				if (res.code == 1) {
					this.list.data = res.data
				} else {
					this.list.data = []
					this.http.toast('系統處理中，請稍後再試');
				}
			},
			getzhusuInfo() {
				uni.showLoading({
					mask: true,
					title: "加載中"
				})
				this.http.request('/api/Hotel/showHotelOrderIndex', 'POST', {
					shop_id: this.shop_id, //店鋪id
					date: this.y + "-" + this.m,
					lc_id: this.lc_id,
				}).then(res => {
					let arr = [] //订房情况
					res.data.dateData.forEach((item, index) => {
						let pushdata = {
							name: item.day, //当前日
							childhouse: []
						}
						res.data.ssinfo.forEach(current => {
							current.house.forEach(curr => {
								pushdata.childhouse.push({
									houseInfo: curr.cgcgb[index].cgcgbData,
									ShoptableLock: curr.cgcgb[index].ShoptableLock,
									deskId: current.id,
									houseId: curr.id
								})
							})
						})
						arr.push(pushdata)
					})
					res.data.ssinfo.forEach(item => {
						item.table_status = item.table_status == 1 ? true : false
					})
					uni.hideLoading()
					this.leftzt = res.data.ssinfo
					this.rightHouse = arr
					console.log(this.leftzt, this.rightHouse);
				})
			},
			jumpurl(url) {
				this.editshow = false
				uni.navigateTo({
					url
				})
			},
			edititem(item) { //点击使用操作
				const _this = this;
				const currentTime = Date.now()
				const gap = currentTime - this.lastTapDiffTime
				if (this.lastTapTimeoutFunc) {
					clearTimeout(this.lastTapTimeoutFunc)
					this.lastTapTimeoutFunc = null
				}
				// 如果兩次點擊間隔小於250ms，則視為雙擊
				if (gap > 0 && gap < 250) {
					console.log('雙機');
					if (item.status == 0) { //空餘的桌臺雙擊彈框編輯
						_this.id = item.id
						_this.order_goods_id = item.order_goods_id
						_this.status = item.status
						_this.currentitem = item
						_this.editshow = true
						return false
					}
					this.lastTapDiffTime = 0
				} else {
					this.lastTapDiffTime = currentTime
					// 單擊延時處理（可選）
					this.lastTapTimeoutFunc = setTimeout(() => {
						console.log('dan機');
						if (this.lastTapDiffTime !== 0 && Date.now() - this.lastTapDiffTime >= 250) {
							if (_this.type == 0) { //type=0正常進入,type=1pos點餐進入
								if (item.status == 0 && _this.hy_type == 1) { //吃到飽訂單開桌邏輯
									uni.navigateTo({
										url: "/pages/workbench/tianjiacdbkh?id=" + item.id
									})
									return false
								}
								if (item.status == 0 && _this.hy_type != 1) { //如果不是從pos點餐過來,桌臺空餘情況下,從這裏跳轉開桌
									uni.redirectTo({
										url: "/pages/workbench/newpos?id=" + item.id + "&name=" + item.num
									})
									return false
								}
								if (item.status == 1 && Number(item.zhuimoney) || item.status == 1 && !Number(item
										.zhuimoney)) { //彈框商品訂單，結賬,清卓
									_this.id = item.id
									_this.order_goods_id = item.order_goods_id
									_this.status = item.status
									_this.currentitem = item
									_this.editshow = true
								}
							} else { //pos點餐返回
								if (item.status == 0) { //空餘
									uni.$emit("poscheckTab2", {
										id: item.id,
										name: item.num
									})
									uni.navigateBack(1)
								} else if (item.status == 1) { //使用中，走編輯
									if (item.ordergoods.status == 88) {
										_this.http.toast("訂單已完成，無法編輯！")
									} else {
										uni.$emit("editTaborder", {
											id: item.id,
											name: item.num,
											order_goods_id: item.order_goods_id
										})
										uni.navigateBack(1)
									}
								}
							}
							this.lastTapDiffTime = 0
						}
					}, 250)
				}
			},
			editDesk() { //编辑使用
				this.editshow = false
				this.dsshow = false
				uni.navigateTo({
					url: "/pages/workbench/xinzengzt?id=" + this.id
				})
			},
			editzhusu(item, val, current) {
				this.id = item.id
				if (val == 0) { //指定房間（只展示一個房間）狀態為待打掃需要打掃
					uni.navigateTo({
						url: "/pages/workbench/xinzengzt?id=" + this.id
					})
					return false
				}
				if (val == 1 && this.houtel_type == 1 && item.house[0].status == 3) { //指定房間（只展示一個房間）狀態為待打掃需要打掃
					this.dsshow = true
					this.dsid = item.house[0].id
					return false
				}
				if (val == 2 && current.status == 3) { //不指定房間（展示多個房間）狀態為待打掃需要打掃
					this.dsshow = true
					this.dsid = current.id
					return false
				}
				uni.navigateTo({
					url: "/pages/workbench/xinzengzt?id=" + this.id
				})
			},
			// 打掃房間
			dasao() {
				this.dsshow = false
				this.http.request('/api/hotel/clHouse', 'POST', {
					id: this.dsid,
					status: 1
				}).then(res => {
					this.http.toast(res.msg)
					if (res.code == 1) {
						this.getzhusuInfo()
					}
				})
			},
			async clearConfirm() { //確認清桌
				let _this = this
				let res = await this.http.request('/api/shop/cleartable', 'POST', {
					id: this.id
				})
				if (res.code == 1) {
					this.http.toast("清桌成功")
					this.getList()
				} else {
					this.http.toast(res.msg)
				}
				this.clearShow = false
			},
			async confirm() { //確認刪除使用
				let _this = this
				let res = await this.http.request('/api/shop/deltable', 'POST', {
					id: this.id
				})
				if (res.code == 1) {
					this.http.toast("刪除成功！")
					let index = this.list.data.findIndex(item => {
						return this.id == item.id
					})
					this.list.data.splice(index, 1)
				} else if (res.code == 0) {
					this.http.toast(res.msg)
				} else {
					this.http.toast('系統處理中，請稍後再試');
				}
				this.show = false
			},
			chidaobaodc(order_id, cdbtc_id) { //吃到飽點餐
				uni.setStorageSync("order_make_id", order_id)
				uni.navigateTo({
					url: "/pages/yuYueOrder/zizhucan?cdbtc_id=" + cdbtc_id
				})
			},
			diancan() {
				this.editshow = false
				// 如果桌上有人了直接跳转選擇商品不然的话就先添加客户信息
				if (this.status == 0) { //添加客户信息
					// uni.navigateTo({
					// 	url: "/pages/workbench/tianjiakhxx?id=" + this.id
					// })
				} else { //選擇商品
					if (this.order_goods_id) {
						uni.setStorageSync("order_goods_id", this.order_goods_id)
					} else {
						uni.removeStorageSync("order_goods_id")
					}
					uni.navigateTo({
						url: "/pages/callOutOrder/xuanzefw"
					})
				}
			},

			jiezhang() {
				this.editshow = false
				uni.navigateTo({
					url: "/pages/workbench/dingdanxq?id=" + this.order_goods_id
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	.resetbtn {
		width: 30%;
		border: 1rpx solid #ffb800;
		border-radius: 50rpx;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
	}

	.leftresetbtn {
		width: 30%;
		background-color: #fae9e1;
		border-radius: 50rpx;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
	}

	.surebtn {
		width: 30%;
		background-color: #ffb800;
		border-radius: 50rpx;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
	}

	::v-deep.u-count-down__text {
		color: #FF5C00 !important;
		font-size: 32rpx !important;

	}

	.fuwuimg {
		width: 100%;
		height: 276rpx;
		position: absolute;
		top: 0;
		left: 0;
		background-image: url("../../static/image/system/hujiaofw.png");
		background-size: 100% 100%;
		z-index: 10;
	}

	.listtop {
		height: 250rpx;
		box-sizing: border-box;
	}

	.flexcolumn {
		justify-content: space-between;
		align-items: center;
	}

	.itembox1 {
		border: 2rpx solid #00B855;
		background-color: #e1f3e9;

	}

	.itembox2 {
		border: 2rpx solid #feb700;
		background-color: #faf4df;
	}

	.itembox3 {
		border: 2rpx solid #ff5c00;
		background-color: #fae9e1;
	}

	.itembox {
		width: 48%;
		padding-bottom: 100rpx;
		position: relative;
	}

	.xiaobiao1 {
		background-color: #cbedda;
		color: #00B855;
	}

	.xiaobiao2 {
		background-color: #faeecb;
		color: #feb800;
	}

	.xiaobiao3 {
		background-color: #f8dbca;
		color: #ff5c00;
	}

	.xiaobiao {
		font-size: 22rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		padding: 5rpx 40rpx;
		border-radius: 50rpx;
	}

	.bottomzh {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		padding: 20rpx 0;
		text-align: center;
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}

	.bottomzh1 {
		background-color: #00B855;
	}

	.bottomzh2 {
		background-color: #feb800;
	}

	.bottomzh3 {
		background-color: #ff5c00;
	}
</style>
<style lang="scss" scoped>
	.margin_top6 {
		margin-top: 60rpx !important;
	}

	.bghuang {
		background-color: #f6a347 !important;
	}

	.bglv {
		background-color: #76cb9d !important;
	}

	.bghong {
		background-color: #ff0000 !important;
	}

	.bgqian {
		background-color: #76cb9d !important;
	}

	.bglan {
		background-color: #0075ff !important;
	}

	.itemboxzs {
		width: 120rpx;
		height: 70rpx;
		margin-top: 2rpx;
		margin-right: 2rpx;
		background-color: #e3e6ed;
	}

	.itemleftbox {
		width: 100rpx;
		height: 70rpx;
		margin-top: 2rpx;
		text-align: center;
	}

	.toumd {
		opacity: 0.5;
	}

	.xiahuaxian1 {
		border-bottom: 1rpx solid #F5F5F5;
	}

	.nerbox {
		padding: 38rpx 31rpx;
	}

	.wexbxo {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.scroll-view-item_H {
		display: inline-block;
	}

	.scroll-view_H {
		white-space: nowrap;
		width: 100%;
		// height: 100rpx;
	}

	.youbk {
		border-right: 2rpx solid #F5F5F5;
	}

	.yxzbox {
		background: #1BA95B;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.lvbox {
		padding: 10rpx 20rpx;
		border-radius: 50rpx;
		color: #FFFFFF;
		font-size: 26rpx;
		margin: 30rpx 30rpx 0 0;
		background-color: #1ba95d;
	}

	.xiaolvbox {
		padding: 10rpx 20rpx;
		border-radius: 50rpx;
		color: #999;
		margin: 30rpx 30rpx 0 0;
		background-color: #effff6;
		font-size: 26rpx;
	}

	.huibox {
		padding: 10rpx 20rpx;
		border-radius: 50rpx;
		color: #999;
		margin: 30rpx 30rpx 0 0;
		background-color: #f7f7f7;
		font-size: 26rpx;
	}

	.shijbox {
		padding: 12rpx 20rpx;
		background: #1BA95B;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
	}

	.chanbox {
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		border: 2rpx solid #1BA95B;
		// width: 260rpx;
	}

	.yixlbtn {
		padding: 10rpx 20rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		background: #0075ff;
		width: 40rpx;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
	}

	.wexzlbtn {
		padding: 10rpx 20rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		width: 40rpx;
		background: #1BA95B;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
	}

	.qianbtn {
		padding: 10rpx 20rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		width: 40rpx;
		background: #cdcdcd;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
	}

	.huibtn {
		padding: 10rpx 20rpx;
		background: #F5F5F5;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		width: 40rpx;
		color: #cdcdcd;
		background: #cdcdcd;
	}

	.weixzx {
		padding-bottom: 10rpx;
		// border-bottom: 6rpx solid #F5F5F5;
		// background: #1BA95B;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
	}

	.zitixhx {
		padding-bottom: 10rpx;
		border-bottom: 6rpx solid #1BA95B;
		// background: #1BA95B;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
	}

	page {
		background-color: #F9F9F9;
	}
</style>